from typing import *


class Solution:

    def findIndices(self, nums: List[int], indexDifference: int,
                    valueDifference: int) -> List[int]:
        mn, mx = 0, 0
        for i in range(indexDifference, len(nums)):
            num, j = nums[i], i - indexDifference
            mn = mn if nums[mn] < nums[j] else j
            mx = mx if nums[mx] > nums[j] else j
            if abs(num - nums[mn]) >= valueDifference:
                return [mn, i]
            if abs(num - nums[mx]) >= valueDifference:
                return [mx, i]
        return [-1, -1]
